package com.sure.supermarketserver.stock.supplier.dao;

import com.sure.supermarketserver.stock.supplier.Supplier;
import com.sure.supermarketserver.stock.supplier.SupplierDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SupplierDao {
    List<Supplier> findSupplierList(SupplierDto dto);

    @Insert("insert into supplier(su_id,su_name,su_tel,su_person) values(#{su_id},#{su_name},#{su_tel},#{su_person})")
    void insertSupplier(SupplierDto dto);

    @Update("update supplier set su_remark = true where su_id =#{id}")
    void deleteSupplier(String id);

    @Update("update supplier set su_name=#{su_name},su_tel=#{su_tel},su_person=#{su_person} where su_id=#{su_id}")
    void updateSupplier(SupplierDto dto);

    @Select("select count(0) from supplier where su_id=#{su_id}")
    boolean findSupplier(String su_id);
}
